package com.livesource.server.github;

import com.livesource.server.URLUtilities;

public class LiveSourceAPI {

	// https://livesourceapi.appspot.com/livesourceapi/GetGithubFileFeature
	// ?access_token=b5af59983483e88f308487943fc5308b225e7225&token_type=bearer
	// &githubRepository=LiveSource/TicTacToe4j
	// &fileExtension=java
	// &sha=63756ce4c0bc4da4b4bbe9e90f8d2c3181489186

	private static final String getFileURL = "https://livesourceapi.appspot.com/livesourceapi/GetGithubFileFeature";

	public static String getFile(final String authToken,
			final String githubRepository, final String fileExtension,
			final String sha) {

		String parameters = "githubRepository=" + githubRepository
				+ "&fileExtension=" + fileExtension + "&sha=" + sha + "&"
				+ authToken;

		final String jsonString = URLUtilities.fetchURLPost(getFileURL, parameters);

		return jsonString;
	}
}
